package com.yangbwe.Springtest;


import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

//实现通过配置文件application来创建对象，并赋值
public class Springtest02 {

    @Test
    public void test01(){
    String config="applicationContest.xml";
    ApplicationContext a=new  ClassPathXmlApplicationContext(config);
        User user = (User) a.getBean("myUser");
        System.out.println("结果是"+user);
        user.setInfoma("这是设置的inf");
        user.setName("这是在代码中设置的name");
        System.out.println("修改后的结果是"+user);


    }


}
